package com.jiexin.beans;

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;

/**
 * @Author: Jay_Liu
 * @Description: 分页请求参数
 * @Date: Created in 10:39 2018/4/7 0007
 * @Modified By:
 */
@ToString
public class PageQuery {

    @Getter
    @Setter
    @Min(value = 1, message = "当前页码不合法")
    private int pageNo = 1;

    @Getter
    @Setter
    @Min(value = 1, message = "每页数量不合法")
    private int pageSize = 10;

    @Setter
    private int offset;//偏移量

    public int getOffset() {
        return (pageNo - 1) * pageSize;
    }

}
